<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of products
 *
 * @author dmitry
 */
class Controller_Products extends Controller_Action {
    //put your code here
    function index() {
        
    }
    
    function category($id)
    {
        if(!isset ($_POST['page']))
        {
            $page = 1 ;
        } else {
            $page = $_POST['page'] ;
        }
        $this->registry->get('view')->set('page', $page) ;
        $this->registry->get('view')->set('id', $id) ;
        $this->registry->get('view')->show('category') ;
    }
    
    function goods($id)
    {
        $this->registry->get('view')->set('id', $id) ;
        $this->registry->get('view')->show('goods') ;
    }
    
    function addComment($id)
    {
        $this->registry->get('view')->set('productID', $id) ;
        $this->registry->get('view')->set('userID', $_POST['user']) ;
        $this->registry->get('view')->set('commentID', $_POST['id']) ;
        $this->registry->get('view')->set('commentContent', $_POST['comment']) ;
        $this->registry->get('view')->show('discuss') ;
    }
    
    function all($id)
    {
        if(!isset ($_POST['page']))
        {
            $page = 1 ;
        } else {
            $page = $_POST['page'] ;
        }
        $this->registry->get('view')->set('page', $page) ;
        $this->registry->get('view')->set('id', $id) ;
        $this->registry->get('view')->show('all') ;
    }
    
    function search()
    {
        if(!isset ($_POST['page']))
        {
            $page = 1 ;
        } else {
            $page = $_POST['page'] ;
        }
        $this->registry->get('view')->set('page', $page) ;
        $this->registry->get('view')->set('word', $_POST['search']) ;
        $this->registry->get('view')->show('search') ;
    }
}

?>
